import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    num:10,
    city:"武汉"
  },
  mutations: {
    add(state){
      state.num++
      // console.log(state.num);
    },
    handleCity(state,city){
      state.city = city
    }
  },
  actions: {
    addNum(ctx){
      ctx.commit("add")
    },
    changeCity(ctx,city){
      // console.log(ctx);
      ctx.commit("handleCity",city)
    }
  },
  modules: {
  }
})
